﻿/*
 * Created by SharpDevelop.
 * User: Andrew Sadler
 * Date: 06/09/2012
 * Time: 23:56
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */

using System.Collections.Generic;
using System.Drawing;

using RRRSRoguelike.Entities;
using RRRSRoguelike.Helpers;
using RRRSRoguelike.Helpers.Visualizer;
using RRRSRoguelike.Managers;
using RRRSRoguelike.Screens;

namespace RRRSRoguelike
{
	/// <summary>
	/// Description of VanillaDungeonScreen.
	/// </summary>
	public class VanillaDungeonScreen : DungeonScreen
	{
		public VanillaDungeonScreen(int seed = -1)
			: base(seed)
		{
		}

		protected override void StartGame(int seed = -1)
		{
			SetupPanels();
			InitializeManagers(seed);
			LoadContent();
			base.StartGame(seed);
		}

		private void SetupPanels()
		{
			PanelList = new List<Panel>
							{
								new Panel(new Point(1, 1), Visualizer.GetScreenWidth() - 2, 5),
								new Panel(new Point(1, 27), Visualizer.GetScreenWidth() - 2, 20),
								new MenuPanel(new Point(1, 5), 38, Constants.DungeonHeight + 2),
								new Panel(new Point(60, 5), 38, Constants.DungeonHeight + 2)
							};
		}

		void LoadContent()
		{
			DungeonManager.Instance.SoundManager.AddCustomSound("Battle", "Battle.wav");
			DungeonManager.Instance.Dungeon = new Dungeon();
			DungeonManager.Instance.Dungeon.LoadData("Vanilla.xml");
			DungeonManager.Instance.Dungeon.SetupLayers();
			DungeonManager.Instance.PropManager.PropsToTiles();
			DungeonManager.Instance.CreatureManager.SetupPlayer(
			DungeonManager.Instance.DungeonLevel.GetValidRandomPoint(true));
			DungeonManager.Instance.CreatureManager.Player.Stats = new Stats();
			DungeonManager.Instance.DungeonLevel.CreateRandomDungeonObjects();

			SetDefaultKeys();
		}

		public override void Show()
		{
			base.Show();
			StartGame(seed);
		}
	}
}
